package br.ufrgs.dbproject.database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DatabaseConnector {

	public static final String JDBC_POSTGRES_DRIVER = "org.postgresql.Driver";
	
	public static Connection createDatabaseConnection(String host, String user, String pass) {
		try {
			Class.forName(JDBC_POSTGRES_DRIVER);
			Connection connection = DriverManager.getConnection(host, user, pass);
			
			return connection ;
			
		} catch (ClassNotFoundException e) {
			throw new RuntimeException("Could not find postgres jdbc driver in yout classpath.", e);
		} catch (SQLException e) {
			throw new RuntimeException("Could not get database connection.", e);
		}
	}
}
